# -*- coding: utf-8 -*-
# @Author    : Tian Wencheng
# @CreateTime: 2021/1/9 19:22
# @FileName  : login.py.py
# @IDE       : PyCharm
# @Git       : https://gitee.com/dianetian/projects

from common.log import logger
from common.request import HTTPRequest
from interface.base import BaseModule


class LogoutModule(BaseModule):
    def __init__(self):
        self.request_url = "/api/logout"
        self.request_method = "POST"
        self.request_headers = {"Content-Type": "application/json"}
        self.request_params = None
        self.cookies = super().cookies
        self.web_url = super().web_url
        self.url = self.web_url + self.request_url

    def user_logout(self):
        response = HTTPRequest().http_request(method=self.request_method, url=self.url, headers=self.request_headers,
                                              params=self.request_params)
        setattr(BaseModule, "cookies", None)
        return response
